package com.zkthink.ceres.order.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.zkthink.base.entity.Entity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * @ClassName ManageProfitOrder
 * @Description: ManageProfitOrder
 * @Author ck
 * @Date 2021/4/9
 * @Version V1.0
 **/
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("ceres_manage_profit_order")
@ApiModel(value = "ManageProfitOrder", description = "管理者获得的提成和贡献值")
@AllArgsConstructor
public class ManageProfitOrder extends Entity<Long> {
    private static final long serialVersionUID = 1L;


    /**
     * 客户id
     */
    @ApiModelProperty(value = "客户id")
    @NotNull(message = "客户id不能为空")
    @TableField("mid")
    @Excel(name = "客户id")
    private Long mid;

    /**
     * 产品id
     */
    @ApiModelProperty(value = "产品id")
    @TableField("product_id")
    @Excel(name = "产品id")
    private Long productId;

    /**
     * 客户购买商品得到的贡献值
     */
    @ApiModelProperty(value = "贡献值")
    @TableField("contribution")
    @Excel(name = "贡献值")
    private Long contribution = 0L;


    /**
     * 现金
     */
    @ApiModelProperty(value = "现金")
    @TableField("cash")
    @Excel(name = "现金")
    private Long cash = 0L;


    /**
     * 订单号
     */
    @ApiModelProperty(value = "订单号")
    @NotEmpty(message = "订单号不能为空")
    @Length(max = 16, message = "订单号长度不能超过16")
    @TableField(value = "order_no", condition = LIKE)
    @Excel(name = "订单号")
    private Long orderNo;


    /**
     * 结算状态 1未结算 2已结算
     */
    @ApiModelProperty(value = "结算状态 1未结算 2已结算")
    @NotNull(message = "结算状态 1未结算 2已结算不能为空")
    @TableField("settle_status")
    @Excel(name = "结算状态 1未结算 2已结算")
    private Integer settleStatus;
    /**
     * 订单实付金额
     */
    @ApiModelProperty(value = "订单实付金额")
    @NotNull(message = "订单实付金额不能为空")
    @TableField("order_amount")
    @Excel(name = "订单实付金额")
    private Long orderAmount;

    /**
     * 商户编号
     */
    @ApiModelProperty(value = "商户编号")
    @NotEmpty(message = "商户编号不能为空")
    @TableField("tenant_code")
    private String tenantCode;

    /**
     * 逻辑删除 1-删除 0-未删除
     */
    @ApiModelProperty(value = "逻辑删除 1-删除 0-未删除")
    @NotNull(message = "逻辑删除 1-删除 0-未删除不能为空")
    @TableField("is_delete")
    @Excel(name = "逻辑删除 1-删除 0-未删除")
    @TableLogic
    private Integer isDelete;

    @Builder
    public ManageProfitOrder(Long id, LocalDateTime updateTime, Long updateUser, LocalDateTime createTime, Long createUser, Integer isDelete,
                             Integer settleStatus, Long orderAmount, Long orderNo, Long mid, Long productId, Long contribution, Long cash, String tenantCode) {
        this.id = id;
        this.updateTime = updateTime;
        this.updateUser = updateUser;
        this.createTime = createTime;
        this.createUser = createUser;
        this.isDelete = isDelete;
        this.orderAmount = orderAmount;
        this.settleStatus = settleStatus;
        this.orderNo = orderNo;
        this.mid = mid;
        this.productId = productId;
        this.contribution = contribution;
        this.cash = cash;
        this.tenantCode = tenantCode;

    }
}
